package com.example.looptask;

import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @author 江黎
 * @since 2022-10-15
 */
@Component
public class ContextRefreshEventListener {

    @EventListener(ContextRefreshedEvent.class)
    public void onContextRefreshEvent(ContextRefreshedEvent event) {
        System.out.println("spring ioc 容器启动完毕");
    }

    public static void main(String[] args) {
        String bomVersion = "v1111.1111.1111.111";
        // 校验版本格式是否正确
        String regex = "^v\\d+(\\.\\d+)+";
        boolean matches = bomVersion.matches(regex);
        if (!matches) {
            System.out.println("错误");
        } else {
            System.out.println("正确");
        }
    }

}
